import React, {Component} from 'react';
import {connect} from 'react-redux';
import {Button} from 'antd';
import {setName} from '../../redux/actions';
class List extends Component {
    constructor(props) {
        console.log(props);
        super(props);
    }
    handleClick() {
        this.props.setName('大大大');
    }
    render() {
        console.log('hshshf')
        return (
            <>
            <Button onClick={this.handleClick.bind(this)}>列表</Button>
            {this.props.name}
            </>
            
        );
    }
}

const mapStateToProps = (state, ownProps) => {
    console.log(state);
    return {
        name: state.NameStore.name,
    };
};
const mapDispatchToProps = (dispatch) => {
    return {
        setName: (name) => dispatch(setName(name)),
    }
};

const ListContainer = connect(mapStateToProps, mapDispatchToProps)(List);
console.log(ListContainer)
console.log(List)
export default ListContainer;
